package xjtu.se.articlecommunity.user.myself.impl;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import xjtu.se.articlecommunity.user.myself.MyFollowService;
import xjtu.se.articlecommunity.user.myself.dao.MyFollowDao;
import xjtu.se.articlecommunity.user.myself.dto.FollowedUser;

import javax.annotation.Resource;
import java.util.List;

@Service
@Transactional
public class MyFollowServiceImpl implements MyFollowService {
    @Resource
    private MyFollowDao myFollowDao;

    @Override
    public List<FollowedUser> getInfo(String u_id) {
        List<FollowedUser> list=myFollowDao.getInfoByU_id(u_id);
        return  list;
    }

    @Override
    public void cancleFollow(String u_id, String befollowed_u_id) {
        myFollowDao.setIfCheckedByDto(u_id,befollowed_u_id);
    }

    @Override
    public List<FollowedUser> getFansInfo(String u_id) {
        return myFollowDao.getFansInfoByU_id(u_id);
    }


}
